const websocket = require("websocket");

import Utils from "../../utils/Utils";
import { NetDefine } from "../protobufs/NetDefine";

function guest_login(key) {
    /** 本地获取，如果没有，则自动生成32位的key */
    if (!key) {
        key = Utils.randomString(32);
    }
    cc.log(NetDefine.ProtocolDefine.Auth, NetDefine.CmdDefine.Auth.GUEST_LOGIN, key);
    websocket.send_cmd(NetDefine.ProtocolDefine.Auth, NetDefine.CmdDefine.Auth.GUEST_LOGIN, key);
}

const auth = {
    guest_login: guest_login,
}

module.exports = auth;